package com.hanoi.wiki.model.json;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.hanoi.wiki.model.Category;
import com.hanoi.wiki.model.CategorySubType;
import com.hanoi.wiki.model.CategoryType;

public class CategoryTypeJson extends BaseJsonObject implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private int id;
	private String typeName;
	private int status;
	private List<Integer> categories;
	private List<Integer> categorySubTypes;
	
	public CategoryTypeJson() {
		categorySubTypes = new ArrayList<Integer>();
	}
	
	public CategoryTypeJson(CategoryType categoryType) {
		this();
		if(categoryType != null) {
			this.id = categoryType.getId();
			this.typeName = categoryType.getTypeName();
			this.status = categoryType.getStatus();
			
			for(Category category : categoryType.getCategories()) {
				if(category != null) {
					this.categories.add(category.getId());
				}
			}
			
			for(CategorySubType subType : categoryType.getCategorySubTypes()) {
				if(subType != null) {
					this.categorySubTypes.add(subType.getId());
				}
			}
		}
	}
	
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTypeName() {
		return typeName;
	}
	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public List<Integer> getCategories() {
		return categories;
	}
	public void setCategories(List<Integer> categories) {
		this.categories = categories;
	}
	public List<Integer> getCategorySubTypes() {
		return categorySubTypes;
	}
	public void setCategorySubTypes(List<Integer> categorySubTypes) {
		this.categorySubTypes = categorySubTypes;
	}
	
	
}
